/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.sigeden.teste;

import br.com.sigeden.model.Categoria;
import br.com.sigeden.util.HibernateUtil;
import java.util.List;
import javax.swing.JOptionPane;
import org.hibernate.Session;
import org.hibernate.Transaction;

/**
 *
 * @author David
 */
public class Teste {
    public static void main(String[] args){
        Session session = HibernateUtil.getSessionFactory().openSession();
      //  Transaction transaction = session.beginTransaction();
        
        //Categoria categoria = new Categoria();
        //categoria.setNome(JOptionPane.showInputDialog("Categoria: "));
         List<Categoria> listaDeCategorias = (List<Categoria>)session.createQuery("From Categoria").list();       
        for(Categoria c : listaDeCategorias ){
            System.out.println(c.getNome());
        }
         //session.save(categoria);
        //transaction.commit();
    }
}
